﻿//********************************************************************************//
//创建日期：<创建日期，2016-09-13>
//创建作者：<孙雪婷，sunxueting@shanghai3h.com>
//功能说明：开户
//********************************************************************************//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Entity;
using BLL;
using BLL.Access;
using System.Data;
using Platform.Http;
using Web.Class;
using System.Text;

namespace Web.Pages.QuShui.DiXiaS.YongHuGL.HuJiGL
{
    public partial class KaiHu :BasePage
    {
        #region 属性

        /// <summary>
        /// gridView主键(用户信息ID)
        /// </summary>
        private int YONGHUXXID
        {
            get
            {
                return Convert.ToInt32(ViewState["_YONGHUXXID"]);
            }
            set
            {
                ViewState["_YONGHUXXID"] = value;
            }
        }

        /// <summary>
        /// 保存结果集
        /// </summary>
        private DataTable dtSource
        {
            get
            {
                return ViewState["dtSource"] as DataTable;
            }
            set
            {
                ViewState["dtSource"] = value;
            }
        }

        #endregion

        #region 变量

        /// <summary>
        /// 数据访问操作类
        /// </summary>
        SpHelper _spHelper = new SpHelper();

        /// <summary>
        /// 用户信息对象
        /// </summary>
        QS_YG_YONGHUXX _QS_YG_YONGHUXX = new QS_YG_YONGHUXX();

        /// <summary>
        /// 用户信息BLL
        /// </summary>
        QS_YG_YONGHUXXBLL _QS_YG_YONGHUXXBLL = new QS_YG_YONGHUXXBLL();

        QS_JX_XINGZHENGQBLL XZQ = new QS_JX_XINGZHENGQBLL();

        QS_JX_HANGYEFLXXBLL HYFL = new QS_JX_HANGYEFLXXBLL();


        QS_JX_QUSHUIXXBLL QSYT = new QS_JX_QUSHUIXXBLL();

        QS_JX_BUMENXXBLL GLBM = new QS_JX_BUMENXXBLL();

        QS_JX_LIUYUXXBLL LYXX = new QS_JX_LIUYUXXBLL();

        QS_JX_SHUILIFPXXBLL SLFP = new QS_JX_SHUILIFPXXBLL();

        QS_JX_SHUIZIYFQBLL SZYFQ = new QS_JX_SHUIZIYFQBLL();


        /// <summary>
        /// 日志BLL
        /// </summary>
        SYS_LOGBLL _SYS_LOGBLL = new SYS_LOGBLL();

        #endregion

        #region 事件

        /// <summary>
        /// 页面加载事件
        /// </summary>
        protected void Page_Load(object sender, EventArgs e)
        {
            //第一次页面加载
            if (!IsPostBack)
            {
                InitControl(false);
                InitData();
                Display();
            }
        }

      

        /// <summary>
        /// 查询管理块
        /// </summary> 
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            //if (txtConYongHuH.Text == "")
            //{
            //    PageTools.AlertMsg(this, "用户号为空,请输入！");
            //    return;
            //}
            //else
            //{
            //    this.Status = GridViewStatus.Init;
            //    InitControl();
            //    DataTable dt = this._QS_YG_YONGHUXXBLL.SelectQS_YG_YONGHUXXesDynamic(string.Format("I_JLZT=0 and S_YONGHUH={0} ", this.txtConYongHuH.Text.Trim()), null);
            //    if (dt == null || dt.Rows.Count < 1)
            //    {
            //        this.YONGHUXXID = -1;
            //        PageTools.AlertMsg(this, "该用户不存在,请重新输入！");
            //    }
            //    else
            //    {
            //        this.YONGHUXXID = Convert.ToInt32(dt.Rows[0]["ID"]);
            //        this.Status = GridViewStatus.Search;
            //        Display();
            //        SetData();
            //    }
            //}
            
        }



        /// <summary>
        /// 放弃
        /// </summary>
        protected void btnCancel_Click(object sender, EventArgs e)
        {
            this.Status = GridViewStatus.Init;
            Display();
            //如果当前有操作项 重新加载数据
            if (this.YONGHUXXID > 0)
            {
                SetData();
            }
        }

        /// <summary>
        /// 修改
        /// </summary>
        protected void btnKaiHu_Click(object sender, EventArgs e)
        {
            this.Status = GridViewStatus.Add;
            //记忆当前修改的ID
            Display();
        }

        /// <summary>
        /// 保存
        /// </summary>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (ValidateData())
            {
                SaveData();
            }
        }


        /// <summary>
        /// 响应前台回调
        /// </summary>
        protected void ASPxCallback1_Callback(object source, DevExpress.Web.CallbackEventArgs e)
        {

        }

        #endregion

        #region 方法

        /// <summary>
        /// 初始化控件
        /// </summary>
        private void InitControl(bool bl)
        {
            if (!bl)
            {
                txtConYongHuH.Text = "";
                txtYONGHUM.Text = "";
                cbmGuanLiBM.Text = "";
                txtShuiJia.Text = "";
                cmbYeWuY.Text = "";
                cmbXingZhengQ.Text = "";
                cmbHuanXianBJ.Text = "";
                cmbQuShuiYT.Text = "";
                cmbHangYeLX.Text = "";
                cmbLiuYu.Text = "";
                cmbShuiLiFP.Text = "";
                cmbShuiZiYFQ.Text = "";
                cmbZhuangBiaoJL.Text = "";
                txtLianXiR.Text = "";
                txtLianXiBM.Text = "";
                txtYouBian.Text = "";
                txtLianXiDH.Text = "";
                txtDiZhi.Text = "";
                txtCaiWuHM.Text = "";
                cmbSFQY.Text = "";
                txtCaiWuDZ.Text = "";
                txtCaiWuYB.Text = "";
                txtKaiHuHM.Text = "";
                txtKaiHuZH.Text = "";
                txtKaiHuYH.Text = "";
                txtHeTongH.Text = "";
                txtBeiZhu.Text = "";
            }
        }

        /// <summary>
        /// 初始化数据
        /// </summary>
        private void InitData()
        {
            int wtype = BusinessTool.WType;
            hid.Value = wtype.ToString();
            if (wtype == 1)
            {
                btnZengJing.Text = "增取水口";
                cmbSFBZ.Items.Add("从电量", "03");
                //cmbSFBZ.Visible = true;
                //sfbz.Visible = true;
            }
            else
            {
                btnZengJing.Text = "增井";
                //cmbSFBZ.Visible = false;
                //sfbz.Visible = false;
            }
            //加载管理部门
            LoadGLBM();
            //加载行政区
            LoadXZQ();
            //加载业务员
            LoadYWY();
            //加载环线标记
            LoadHXBJ();
            //加载取水用途
            LoadQSYT();
            //加载行业分类
            LoadHYFL();
            //加载流域
            LoadLY();
            //水利分片
            LoadSLFP();
            //水资源分区
            LoadSZYFQ();
        }

        /// <summary>
        /// 加载管理部门
        /// </summary>
        private void LoadGLBM()
        {
            DataTable dt = GLBM.SelectQS_JX_BUMENXXesDynamic("I_JLZT=0", null);
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                cbmGuanLiBM.Items.Add(dt.Rows[i]["S_BUMENMC"].ToString(), dt.Rows[i]["S_BUMENBH"]);
            }
        }

        /// <summary>
        /// 加载行政区
        /// </summary>
        private void LoadXZQ()
        {
            DataTable dt = XZQ.SelectQS_JX_XINGZHENGQsDynamic("I_JLZT=0", null);
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                cmbXingZhengQ.Items.Add(dt.Rows[i]["S_XINGZHENGQM"].ToString(), dt.Rows[i]["S_XINGZHENGQH"]);
            }
        }

        /// <summary>
        /// 加载业务员
        /// </summary>
        private void LoadYWY()
        {
            PageTools.QSLoadCombox(cmbYeWuY, PageTools.eLoadType.业务员QS, null, "");
           
        }


        /// <summary>
        /// 加载环线标记
        /// </summary>
        private void LoadHXBJ()
        {
            cmbHuanXianBJ.Items.Add("外环线外", 1);
            cmbHuanXianBJ.Items.Add("外环线内", 1);
        }


        /// <summary>
        /// 加载 取水用途
        /// </summary>
        private void LoadQSYT()
        {
            DataTable dt = QSYT.SelectQS_JX_QUSHUIXXesDynamic("I_JLZT=0", null);
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                cmbQuShuiYT.Items.Add(dt.Rows[i]["S_QUSHUIMC"].ToString(), dt.Rows[i]["S_QUSHUIBH"]);
            }
        }
        /// <summary>
        /// 加载行业分类
        /// </summary>
        private void LoadHYFL()
        {
            DataTable dt = HYFL.SelectQS_JX_HANGYEFLXXesDynamic("I_JLZT=0", null);
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                cmbHangYeLX.Items.Add(dt.Rows[i]["S_FENLEIMC"].ToString(), dt.Rows[i]["S_FENLEIBH"]);
            }
        }

        /// <summary>
        /// 加载流域
        /// </summary>
        private void LoadLY()
        {
            DataTable dt = LYXX.SelectQS_JX_LIUYUXXesDynamic("I_JLZT=0", null);
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                cmbLiuYu.Items.Add(dt.Rows[i]["S_LIUYUMC"].ToString(), dt.Rows[i]["S_LIUYUBH"]);
            }
        }

        /// <summary>
        /// 加载水利分片
        /// </summary>
        private void LoadSLFP()
        {
            DataTable dt = SLFP.SelectQS_JX_SHUILIFPXXesDynamic("I_JLZT=0", null);
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                cmbShuiLiFP.Items.Add(dt.Rows[i]["S_SHUILIFPMC"].ToString(), dt.Rows[i]["S_SHUILIFPBH"]);
            }
        }

        /// <summary>
        /// 加载水资源分区
        /// </summary>
        private void LoadSZYFQ()
        {
            DataTable dt = SZYFQ.SelectQS_JX_SHUIZIYFQsDynamic("I_JLZT=0", null);
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                cmbShuiZiYFQ.Items.Add(dt.Rows[i]["S_SHUIZIYMC"].ToString(), dt.Rows[i]["S_SHUIZIYBH"]);
            }
        }

        

        /// <summary>
        ///用于控制添加、修改、查看三种状态的显示
        /// </summary>
        private void Display()
        {
            switch (this.Status)
            {
                case GridViewStatus.Init:
                    btnKaiHu.Visible = this.YONGHUXXID > 0 ? false : true;
                    btnSave.Visible = false;
                    btnCancel.Visible = false;
                    //btnZengXuKZ.Visible = this.YONGHUXXID > 0 ? true : false;
                    btnZengJing.Visible = this.YONGHUXXID > 0 ? true : false;
                    btnZengBiao.Visible = this.YONGHUXXID > 0 ? true : false;
                    InitControl(this.YONGHUXXID > 0 ? true : false);
                    SetText(false);
                    break;
                case GridViewStatus.Search:
                    btnKaiHu.Visible = true;
                    btnKaiHu.Enabled = true;
                    btnSave.Visible = false;
                    btnCancel.Visible = false;
                    SetText(false);
                    break;
                case GridViewStatus.Update:
                    btnKaiHu.Visible = false;
                    btnSave.Visible = true;
                    btnCancel.Visible = true;
                    //btnZengXuKZ.Visible = false;
                    btnZengJing.Visible = false;
                    btnZengBiao.Visible = false;
                    SetText(true);
                    break;
                case GridViewStatus.Add:
                    btnKaiHu.Visible = false;
                    btnSave.Visible = true;
                    btnCancel.Visible = true;
                    //btnZengXuKZ.Visible = false;
                    btnZengJing.Visible = false;
                    btnZengBiao.Visible = false;
                    txtConYongHuH.Focus();
                    SetText(true);
                    break;

                
            }
        }


        /// <summary>
        /// 设置输入框状态
        /// </summary>
        /// <param name="b"></param>
        private void SetText(bool b)
        {
            txtConYongHuH.ClientEnabled = b;
            txtYONGHUM.ClientEnabled = b;
            cbmGuanLiBM.ClientEnabled = b;
            txtShuiJia.ClientEnabled = b;
            cmbYeWuY.ClientEnabled = b;
            cmbXingZhengQ.ClientEnabled = b;
            cmbHuanXianBJ.ClientEnabled = b;
            cmbQuShuiYT.ClientEnabled = b;
            cmbHangYeLX.ClientEnabled = b;
            cmbLiuYu.ClientEnabled = b;
            cmbShuiLiFP.ClientEnabled = b;
            cmbShuiZiYFQ.ClientEnabled = b;
            cmbZhuangBiaoJL.ClientEnabled = b;
            txtLianXiR.ClientEnabled = b;
            txtLianXiBM.ClientEnabled = b;
            txtYouBian.ClientEnabled = b;
            txtLianXiDH.ClientEnabled = b;
            txtDiZhi.ClientEnabled = b;
            txtCaiWuHM.ClientEnabled = b;
            cmbSFQY.ClientEnabled = BusinessTool.WType == 2 ? b : false;
            txtCaiWuDZ.ClientEnabled = b;
            txtCaiWuYB.ClientEnabled = b;
            txtKaiHuHM.ClientEnabled = b;
            txtKaiHuZH.ClientEnabled = b;
            txtKaiHuYH.ClientEnabled = b;
            txtHeTongH.ClientEnabled = b;
            txtBeiZhu.ClientEnabled = b;
            cmbSFBZ.ClientEnabled = b;

        }

        /// <summary>
        /// 保存数据
        /// </summary>
        private void SaveData()
        {
            int wtype = BusinessTool.WType;
            int slym = BusinessTool.GetSLYMorZWNY(1, wtype);
            OperateState operateState;
            //修改操作
            operateState = OperateState.Add;

            //记录ID 只是用于记录修改日志
            //_QS_YG_YONGHUXX = this._QS_YG_YONGHUXXBLL.SelectQS_YG_YONGHUXX(this.YONGHUXXID);
            _QS_YG_YONGHUXX.ID = 0;
            _QS_YG_YONGHUXX.S_YONGHUH = txtConYongHuH.Text;
            _QS_YG_YONGHUXX.S_YONGHUM = txtYONGHUM.Text;
            _QS_YG_YONGHUXX.S_BUMENBH = cbmGuanLiBM.Text != "" ? cbmGuanLiBM.Value.ToString() : "";
            _QS_YG_YONGHUXX.N_SHUIJIA = txtShuiJia.Text != "" ? Convert.ToDecimal(txtShuiJia.Text) : 0;
            _QS_YG_YONGHUXX.S_YEWUY = cmbYeWuY.Text != "" ? cmbYeWuY.Value.ToString() : "";
            _QS_YG_YONGHUXX.S_XINGZHENGQBH = cmbXingZhengQ.Text != "" ? cmbXingZhengQ.Value.ToString() : "";
            _QS_YG_YONGHUXX.S_HUANXIANBJ = cmbHuanXianBJ.Text != "" ? cmbHuanXianBJ.Value.ToString() : "";
            _QS_YG_YONGHUXX.S_QUSHUIYTBH = cmbQuShuiYT.Text != "" ? cmbQuShuiYT.Value.ToString() : "";
            _QS_YG_YONGHUXX.S_HANGYEBH = cmbHangYeLX.Text != "" ? cmbHangYeLX.Value.ToString() : "";
            _QS_YG_YONGHUXX.S_LIUYUBH = cmbLiuYu.Text != "" ? cmbLiuYu.Value.ToString() : "";
            _QS_YG_YONGHUXX.S_FENPIANBH = cmbShuiLiFP.Text != "" ? cmbShuiLiFP.Value.ToString() : "";
            _QS_YG_YONGHUXX.S_SHUIZIYBH = cmbShuiZiYFQ.Text != "" ? cmbShuiZiYFQ.Value.ToString() : "";
            _QS_YG_YONGHUXX.S_ZHUANGBIAOJL = cmbZhuangBiaoJL.Text != "" ? cmbZhuangBiaoJL.Text.ToString() : "";
            _QS_YG_YONGHUXX.S_LIANXIR = txtLianXiR.Text;
            _QS_YG_YONGHUXX.S_LIANXIBM = txtLianXiBM.Text;
            _QS_YG_YONGHUXX.S_YOUBIAN = txtYouBian.Text;
            _QS_YG_YONGHUXX.S_DIANHUA = txtLianXiDH.Text;
            _QS_YG_YONGHUXX.S_DIZHI = txtDiZhi.Text;
            _QS_YG_YONGHUXX.S_CAIWUHM = txtCaiWuHM.Text;
            _QS_YG_YONGHUXX.I_BY1 = wtype == 2 ? Convert.ToInt32(cmbSFQY.Value) : 0;
            _QS_YG_YONGHUXX.S_CAIWUDZ = txtCaiWuDZ.Text;
            _QS_YG_YONGHUXX.S_CAIWUYB = txtCaiWuYB.Text;
            _QS_YG_YONGHUXX.S_KAIHUHM = txtKaiHuHM.Text;
            _QS_YG_YONGHUXX.S_KAIHUH = txtKaiHuZH.Text;
            _QS_YG_YONGHUXX.S_KAIHUYH = txtKaiHuYH.Text;
            _QS_YG_YONGHUXX.S_HETONGH = txtHeTongH.Text;
            _QS_YG_YONGHUXX.S_ZHUSHI = txtBeiZhu.Text;
            _QS_YG_YONGHUXX.I_WTYPE = wtype;
            _QS_YG_YONGHUXX.I_JLZT = 0;
            _QS_YG_YONGHUXX.S_HETONGH = txtHeTongH.Text;
            _QS_YG_YONGHUXX.S_CAOZUOR = LoginInfo.CurrentUser.UserID.ToString();
            _QS_YG_YONGHUXX.D_CAOZUORQ = DateTime.Now;
            _QS_YG_YONGHUXX.S_TIANJIAR = LoginInfo.CurrentUser.UserID.ToString();
            _QS_YG_YONGHUXX.D_TIANJIARQ = DateTime.Now;
            _QS_YG_YONGHUXX.S_KAISHINY = slym.ToString();
            _QS_YG_YONGHUXX.I_BIAOSHI = cbShiFouTS.Checked == true ? 1 : 0;// 1 托收，0 不托收
            _QS_YG_YONGHUXX.S_FEETYPE = cmbSFBZ.Text != "" ? cmbSFBZ.Value.ToString() : "";
            _SYS_LOGBLL.Log<QS_YG_YONGHUXX>(LoginInfo.CurrentUser, BusinessTool.WType.ToString(), "用户管理-开户", operateState, _QS_YG_YONGHUXX, null);
            bool result = _QS_YG_YONGHUXXBLL.InsertOrUpdate(_QS_YG_YONGHUXX);
            if (result)
            {
                //_SYS_LOGBLL.Log<QS_YG_YONGHUXX>(LoginInfo.CurrentUser, BusinessTool.WType.ToString(), "用户管理-开户", operateState, _QS_YG_YONGHUXX, null);
                //PageTools.AlertMsg(this, "保存成功！");
                //this.Status = GridViewStatus.Search;
                //Display();
                //记录当前操作项ID
                DataTable dtTemp = this._QS_YG_YONGHUXXBLL.SelectQS_YG_YONGHUXXesDynamic(string.Format("I_JLZT=0 AND  S_YONGHUH='{0}'", this._QS_YG_YONGHUXX.S_YONGHUH), null);
                this.YONGHUXXID = Convert.ToInt32(dtTemp.Rows[0]["ID"]);
                this.Status = GridViewStatus.Init;
                PageTools.AlertMsg(this, "保存成功！");
                Display();
            }
            else
            {
                PageTools.AlertMsg(this, "保存失败！");
            }
        }

        /// <summary>
        /// 给输入框赋值
        /// </summary>
        private void SetData()
        {
            _QS_YG_YONGHUXX = _QS_YG_YONGHUXXBLL.SelectQS_YG_YONGHUXX(YONGHUXXID);
            txtYONGHUM.Text = _QS_YG_YONGHUXX.S_YONGHUM;
            cbmGuanLiBM.Value = _QS_YG_YONGHUXX.S_BUMENBH;//
            txtShuiJia.Text = _QS_YG_YONGHUXX.N_SHUIJIA.ToString();
            cmbYeWuY.Value = _QS_YG_YONGHUXX.S_YEWUY;
            cmbXingZhengQ.Value = _QS_YG_YONGHUXX.S_XINGZHENGQBH;
            cmbHuanXianBJ.Value = _QS_YG_YONGHUXX.S_HUANXIANBJ;
            cmbQuShuiYT.Value = _QS_YG_YONGHUXX.S_QUSHUIYTBH;
            cmbHangYeLX.Value = _QS_YG_YONGHUXX.S_HANGYEBH;
            cmbLiuYu.Value = _QS_YG_YONGHUXX.S_LIUYUBH;
            cmbShuiLiFP.Value = _QS_YG_YONGHUXX.S_FENPIANBH;
            cmbShuiZiYFQ.Value = _QS_YG_YONGHUXX.S_SHUIZIYBH;
            cmbZhuangBiaoJL.Text = _QS_YG_YONGHUXX.S_ZHUANGBIAOJL;
            txtLianXiR.Text = _QS_YG_YONGHUXX.S_LIANXIR;
            txtLianXiBM.Text = _QS_YG_YONGHUXX.S_LIANXIBM;
            txtYouBian.Text = _QS_YG_YONGHUXX.S_YOUBIAN;
            txtLianXiDH.Text = _QS_YG_YONGHUXX.S_DIANHUA;
            txtDiZhi.Text = _QS_YG_YONGHUXX.S_DIZHI;
            txtCaiWuHM.Text = _QS_YG_YONGHUXX.S_CAIWUHM;
            cmbSFQY.Value = BusinessTool.WType == 2 ? _QS_YG_YONGHUXX.I_BY1 : null;
            txtCaiWuDZ.Text = _QS_YG_YONGHUXX.S_CAIWUDZ;
            txtCaiWuYB.Text = _QS_YG_YONGHUXX.S_CAIWUYB;
            txtKaiHuHM.Text = _QS_YG_YONGHUXX.S_KAIHUHM;
            txtKaiHuZH.Text = _QS_YG_YONGHUXX.S_KAIHUH;
            txtKaiHuYH.Text = _QS_YG_YONGHUXX.S_KAIHUYH;
            txtHeTongH.Text = _QS_YG_YONGHUXX.S_HETONGH;
            txtBeiZhu.Text = _QS_YG_YONGHUXX.S_ZHUSHI;
        }

        /// <summary>
        /// 保存验证
        /// </summary>
        /// <returns></returns>
        private bool ValidateData()
        {
            if (this.txtConYongHuH.Text == "")
            {
                PageTools.AlertMsg(this, "用户号不能为空！");
                this.txtConYongHuH.Focus();
                return false;
            }
            if (this.txtConYongHuH.Text.Length != 7 || !PageTools.ValidateString(this.txtConYongHuH.Text, PageTools.eValidateType.数字))
            {
                PageTools.AlertMsg(this, "用户号应为7位数字！");
                this.txtConYongHuH.Focus();
                return false;
            }
            if (this.Status == GridViewStatus.Add)
            {
                //判断用户号是否重复
                if (_QS_YG_YONGHUXXBLL.SelectQS_YG_YONGHUXXesDynamic(string.Format("S_YONGHUH='{0}' and ID<>{1}", this.txtConYongHuH.Text, _QS_YG_YONGHUXX.ID), null).Rows.Count > 0)
                {
                    PageTools.AlertMsg(this, "该用户号系统中已有使用,请更换！");
                    return false;
                }
            }
            if (this.txtYONGHUM.Text == "")
            {
                PageTools.AlertMsg(this, "用户名不能为空！");
                this.txtYONGHUM.Focus();
                return false;
            }
            if (this.txtDiZhi.Text == "")
            {
                PageTools.AlertMsg(this, "地址不能为空！");
                this.txtDiZhi.Focus();
                return false;
            }
            if (this.txtYouBian.Text == "")
            {
                PageTools.AlertMsg(this, "邮编不能为空！");
                this.txtYouBian.Focus();
                return false;
            }
            if (this.cmbXingZhengQ.Text == "")
            {
                PageTools.AlertMsg(this, "请选择行政区！");
                this.cmbXingZhengQ.Focus();
                return false;
            }
            if (this.cmbYeWuY.Text == "")
            {
                PageTools.AlertMsg(this, "请选择业务员！");
                this.cmbYeWuY.Focus();
                return false;
            }
            if (txtShuiJia.Text == "")
            {
                PageTools.AlertMsg(this, "水价不能为空！");
                this.txtShuiJia.Focus();
                return false;
            }
            ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            if (cmbHuanXianBJ.Text == "")
            {
                PageTools.AlertMsg(this, "环线标记不能为空！");
                this.cmbHuanXianBJ.Focus();
                return false;
            }
            if (cmbQuShuiYT.Text == "")
            {
                PageTools.AlertMsg(this, "取水用途不能为空！");
                this.cmbQuShuiYT.Focus();
                return false;
            }
            if (cmbHangYeLX.Text == "")
            {
                PageTools.AlertMsg(this, "行业分类不能为空！");
                this.cmbHangYeLX.Focus();
                return false;
            }
            if (cmbLiuYu.Text == "")
            {
                PageTools.AlertMsg(this, "流域不能为空！");
                this.cmbLiuYu.Focus();
                return false;
            }
            if (cmbShuiLiFP.Text == "")
            {
                PageTools.AlertMsg(this, "水里分片不能为空！");
                this.cmbShuiLiFP.Focus();
                return false;
            }
            if (cmbShuiZiYFQ.Text == "")
            {
                PageTools.AlertMsg(this, "水资源分区不能为空！");
                this.cmbShuiZiYFQ.Focus();
                return false;
            }



            //如果为托收,需要填写银行账号,开户银行,开户户名
            if (this.cbShiFouTS.Checked)
            {
                if (this.txtKaiHuZH.Text.Trim() == "")
                {
                    PageTools.AlertMsg(this, "银行账号不能为空！");
                    this.txtKaiHuZH.Focus();
                    return false;
                }
                if (!PageTools.ValidateString(this.txtKaiHuZH.Text, PageTools.eValidateType.数字))
                {
                    PageTools.AlertMsg(this, "请输入数字类型！");
                    this.txtKaiHuZH.Focus();
                    return false;
                }
                if (this.txtKaiHuYH.Text.Trim() == "")
                {
                    PageTools.AlertMsg(this, "开户银行不能为空！");
                    this.txtKaiHuYH.Focus();
                    return false;
                }
                if (this.txtKaiHuHM.Text.Trim() == "")
                {
                    PageTools.AlertMsg(this, "开户户名不能为空！");
                    this.txtKaiHuHM.Focus();
                    return false;
                }
            }

            return true;
        }

        #endregion
    }
}